<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>break和continue语句</title>
	</head>
	<body>
		<script type="text/javascript">
			// break可以跳出当前循环.
			var x = 0;
			// for (;;) {  // 死循环
			for (;;){
				if(x > 100) {
					break;
				}
				x++;
			}
			console.log(x);
			
			var sum = 0;
			for (var i = 1; i <= 10; i++) {
				if (i === 8){
					// break;
					
					// 跳出当前循环,下次循环继续进行.
					continue;
				}
				sum = sum + i;
			}
			alert(sum);
			
		</script>
	</body>
</html>
